home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / aros / source / exec / lists / src / addtail.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-16  |  1.5 KB  |  75 lines

  1. /*
  2.     (C) 1995 AROS - The Amiga Replacement OS
  3.     $Id: addtail.c 1.1 1995/11/05 22:49:09 digulla Exp digulla $
  4.     $Log: addtail.c $
  5.  * Revision 1.1  1995/11/05  22:49:09  digulla
  6.  * Initial revision
  7.  *
  8.     Desc:
  9.     Lang: english
  10. */
  11. #include "exec_intern.h"
  12.  
  13. /*****************************************************************************
  14.  
  15.     NAME */
  16.     #include <exec/lists.h>
  17.     #include <clib/exec_protos.h>
  18.  
  19.     __AROS_LH2I(void, AddTail,
  20.  
  21. /*  SYNOPSIS */
  22.     __AROS_LA(struct List *, list, A0),
  23.     __AROS_LA(struct Node *, node, A1),
  24.  
  25. /*  LOCATION */
  26.     struct SysBase *, SysBase, 41, Exec)
  27.  
  28. /*  FUNCTION
  29.     Insert Node node at the end of a list.
  30.  
  31.     INPUTS
  32.     list - The list to insert the node into
  33.     node - This node is to be inserted
  34.  
  35.     RESULT
  36.  
  37.     NOTES
  38.  
  39.     EXAMPLE
  40.     struct List * list;
  41.     struct Node * pred;
  42.  
  43.     // Insert Node at end of the list
  44.     AddTail (list, node);
  45.  
  46.     BUGS
  47.  
  48.     SEE ALSO
  49.  
  50.     INTERNALS
  51.  
  52.     HISTORY
  53.     26-08-95    digulla created after EXEC-Routine
  54.     26-10-95    digulla adjusted to new calling scheme
  55.  
  56. ******************************************************************************/
  57. {
  58.     assert (node);
  59.     assert (list);
  60.  
  61.     /*
  62.     Make the node point to the head of the list. Our predecessor is the
  63.     previous last node of the list.
  64.     */
  65.     node->ln_Succ           = (struct Node *)&list->lh_Tail;
  66.     node->ln_Pred           = list->lh_TailPred;
  67.  
  68.     /*
  69.     Now we are the last now. Make the old last node point to us
  70.     and the pointer to the last node, too.
  71.     */
  72.     list->lh_TailPred->ln_Succ = node;
  73.     list->lh_TailPred           = node;
  74. } /* AddTail */
  75.